package operation;

import book.book;
import book.booklist;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 666
 * Date: 2022-11-18
 * Time: 20:41
 */
public class findoperation implements Ioper{

    @Override
    public void work(booklist book) {
        System.out.println("请输入你要查找的书名");
        Scanner scanner = new Scanner(System.in);
        String  name= scanner.nextLine();
        int cur=book.getBookSize();
        for (int i = 0; i < cur; i++) {
            book book1=  book.getBooks(i);
            if(book1.getName().equals(name)){
                System.out.println("查找成功");
                System.out.println(book1);
                return;
            }
        }
        System.out.println("没有找到这本书");
    }
}
